﻿using Microsoft.AspNetCore.Razor.TagHelpers;

namespace ReaWTM.LayuiHelper
{


	[HtmlTargetElement("wt:dialog-footer", ParentTag = "wt:dialog", TagStructure = TagStructure.NormalOrSelfClosing)]
	public class DialogFooterTagHelper : BaseTag
	{
		public AlignEnum Align { get; set; } = AlignEnum.Right;
		public override void Process(TagHelperContext context, TagHelperOutput output)
		{
			SetCascadeValue(context, this);

			if (WtSize != WtSizeEnum.None)
			{
				output.Attributes.Add("wtsize", base.GetWtSize());
			}
			output.TagName = "div";
			output.Attributes.SetAttribute("class", $"wtm-dialog-footer");

			switch (Align)
			{
				case AlignEnum.Left:
					output.Attributes.SetAttribute("style", "text-align:left");
					break;
				case AlignEnum.Right:
					output.Attributes.SetAttribute("style", "text-align:right");
					break;
				case AlignEnum.Center:
					output.Attributes.SetAttribute("style", "text-align:center");
					break;
				default:
					break;
			}
		}

	}
}
